package cn.kgc.lqy.demo.services.impl;

import cn.kgc.lqy.demo.mapper.StudentMapper;
import cn.kgc.lqy.demo.pojo.Student;
import cn.kgc.lqy.demo.services.StudentService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service("studentService")
@Transactional
public class StudentServiceImpl implements StudentService {

    @Resource
    private StudentMapper studentMapper;

    @Override
    public List<Student> findAll() {
        return studentMapper.selectAll();
    }

    @Override
    public int addStu(Student student) {
        return studentMapper.insertStu(student);
    }

    @Override
    public int modifyStu(Student student) {
        return studentMapper.updateStu(student);
    }

    @Override
    public int deleteStu(Integer sid) {
        return studentMapper.deleteStu(sid);
    }
}
